package GenericsTest;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        ArrayList<PersianCat> list1=new ArrayList<>();
        ArrayList<LihuaCat> list2=new ArrayList<>();
        ArrayList<Teddy> list3=new ArrayList<>();
        ArrayList<Husky> list4=new ArrayList<>();

        keepPet1(list1);
        //keepPet1(list3); 狗就会报错
        keepPet2(list2);
        keepPet2(list4); //猫狗都可以

    }


    //要求1：该方法能养所有猫，但不能养狗
    public static void keepPet1(ArrayList<? extends Cat> list){

    }

    //要求2:能养所有动物，其他类型不能传
    public static void keepPet2(ArrayList<? extends Animal> list){

    }
}
